import { BasicColumn, FormSchema } from '@apps/antd-admin/src/components/Table';

export const columns: BasicColumn[] = [
  {
    title: '标题',
    dataIndex: 'title',
    width: 120,
    align: 'center',
  },
  {
    title: '操作类型',
    dataIndex: 'optType',
    width: 100,
    align: 'center',
    customRender: ({ record }: Recordable) => {
      const optTypeArray = [
        { label: '增加', value: 1 },
        { label: '使用', value: 2 },
      ];
      const optType: any = optTypeArray.find((item) => item.value == record.optType);
      if (optType) {
        return optType.label;
      }
      return '';
    },
  },
  {
    title: '操作数值',
    dataIndex: 'numValue',
    width: 100,
  },
  {
    title: '是否扣除',
    dataIndex: 'isDeduct',
    width: 80,
    customRender: ({ record }: Recordable) => {
      const isDeductArray = [
        { label: '已扣除', value: 1 },
        { label: '未扣除', value: 2 },
      ];
      const isDeduct: any = isDeductArray.find((item) => item.value == record.isDeduct);
      if (isDeduct) {
        return isDeduct.label;
      }
      return '';
    },
  },
  {
    title: '描述',
    dataIndex: 'body',
    width: 200,
  },
  {
    title: '商品',
    dataIndex: 'goodsName',
    width: 200,
  },
  {
    title: '操作人',
    dataIndex: 'userName',
    width: 120,
    align: 'center',
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 150,
  },
];

export const searchFormSchema: FormSchema[] = [];
